<?php require VIEW_ROOT.'/common/header.php'?>

<script>
$(function() {
	$('.note').each(function(i, obj) {
		height_now = parseInt($(obj).height());
		if(height_now > 250) {
			$(obj).addClass('height_limit');
			$(obj).addClass('height_limit_style');
		}
	});
	
	$('.height_limit').toggle(
		function () { $(this).removeClass('height_limit_style'); },
		function () { $(this).addClass('height_limit_style'); }
	);
	
	$('.create_time').toggle(
		function () { $(this).next().show(100); },
		function () { $(this).next().hide(100); }
	);
});
</script>

<style>
.date { width:205px; text-align:center; padding:2px 0 0 0; height:20px; color:#fff; font-weight:bold; font-size:14px; background:#c00; word-spacing:3px; }
.create_time { font-size:10px; cursor:pointer; color:#aa0000; }
.height_limit_style { height:250px; border-bottom:3px dashed #ff0000; cursor:pointer; }
.tools { display:none; font-size:12px; margin:5px 0 0 0; height:16px; }
.tools a { background:#aa0000; color:#fff; text-decoration:none; display:block; float:left; padding:0 5px 1px 5px; margin:0 5px 0 0; }
</style>

<a name="top"></a>
<div class="info">
	[
	<a href="./?m=note&day=30">30天</a> /
	<a href="./?m=note&day=70">70天</a> /
	<a href="./?m=note&day=380,30">去年</a> /
	<a href="./?m=note&all">全部</a>
	]&nbsp;&nbsp;
	[
	<a href="./?m=note&a=form">添加</a> /
	<a href="./?m=note&a=form_ajax">快加</a>
	]
</div>

<div style="font-weight:bold; margin:0 0 5px 5px; font-size:12px;">
	(总数<?php echo $count_all?> / 当前<?php echo $count_query?>)
</div>

<!-- start.记事列表 -->
<?php foreach ($notes as $key => $row) : ?>

	<div class="date">
		<?php echo date('Y', $key) != date('Y') ? date('Y年', $key) : '';echo date('n月j日', $key); ?>
		星期<?php echo library_common::get_week_name($key); ?>
		(<?php echo count($row)?>)
	</div>

	<?php foreach ($row as $row2) : ?>
		<div class="note info">
			<?php
                $row2['content'] = str_replace(array(' ', "\t"), array('&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'), htmlspecialchars($row2['content']));
                $row2['content'] = nl2br($row2['content']);
                $row2['content'] = preg_replace('/http:\/\/[0-9a-z.,:%_?=&;#\/\-]+/si', '<a href="$0" target="_blank" style="color:#036;">$0</a>', $row2['content']);
                echo $row2['content'];
            ?>
			<span class="create_time"><?php echo library_common::get_time_name($row2['create_time']).date('H:i', $row2['create_time'])?></span>
			<div class="tools">
				<a href="?m=note&a=form_ajax& not_id=<?php echo $row2['not_id']?>" target="_blank">编辑(快速)</a>
                <a href="?m=note&id=<?php echo $row2['not_id']?>" target="_blank">新窗口</a>
				<a href="?m=note&a=form& not_id=<?php echo $row2['not_id']?>" target="_blank">编辑</a>
				<a href="?m=note&a=set& not_id=<?php echo $row2['not_id']?>">设置</a>
			</div>
		</div>
	<?php endforeach; ?>

<?php endforeach; ?>
<!-- end.记事列表 -->

<?php require VIEW_ROOT.'/common/footer.php'?>
